<include file="public@header"/>
<style>
	.cas-thumbnail{
		width:80px;
		height:80px;
	}
	.table td,.table th{
		text-align: center;;
	}
</style>
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('AdminStockIn/index')}">产品入库</a></li>
			<li><a href="{:url('AdminStockIn/logs')}">入库记录</a></li>
		</ul>
		<form class="well form-inline margin-top-20" method="post" action="{:url('AdminStockIn/index')}">
			CAS： 
			<input type="text" class="form-control" name="cas" style="width:100px;" value="{:input('param.cas')}" placeholder="请输入CAS">
			关键字： 
			<input type="text" class="form-control" name="keyword" style="width: 200px;" value="{:input('param.keyword')}" placeholder="请输入化合物名称/分子式">
			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="{:url('AdminStockIn/index')}">清空</a>
		</form>
		<form class="js-ajax-form" action="" method="post">
			<table class="table table-hover table-bordered table-list">
				<thead>
				<tr>
					<th align="center" width="50">ID</th>
					<th width="400">名称</th>
					<th width="100">CAS#</th>
					<th width="100">结构式</th>

					<th width="130">首次入库</th>
					<!--<th width="70">{:lang('STATUS')}</th>-->
					<th width="100">{:lang('ACTIONS')}</th>
				</tr>
				</thead>
				<php>
				$status=array("1"=>"上架","0"=>"下架");
				$top_status=array("1"=>"置顶","0"=>"");
				$recommend_status=array("1"=>"推荐","0"=>"");
				</php>
				<foreach name="products" item="vo">
					<tr>
						<td>{$vo.id}</td>
						<td>
							{$vo.cn_name}
							<notempty name="vo.name">
								<br>{$vo.name}
							</notempty>
						</td>
						<td>{$vo.cas}</td>
						<td>
							<eq name="vo.thumbnail" value="has">
								<img src="http://www.chemium.cn/chemium/api/getCompoundPng/cas/{$vo.cas}" class="cas-thumbnail" onerror="javascript:this.style.visibility='hidden';"/><br>
								<else/>
								<notempty name="vo.thumbnail">
									<img src="{:cmf_get_image_preview_url($vo.thumbnail)}" class="cas-thumbnail" onerror="javascript:this.style.visibility='hidden';"/><br>
									<else/>
									<div style="width: 100px;height: 100px;background: #fff; padding: 0;display: inline-block;">
										<img src="http://www.chemium.cn/chemium/api/getCompoundPng/cas/{$vo.cas}" class="cas-thumbnail" onerror="javascript:this.style.visibility='hidden';"/>
									</div><br>
								</notempty>
							</eq>

							{:sp_beautify_molformula($vo['mol_formula'])}
						</td>


						<td>{:date('Y-m-d H:i',$vo['create_time'])}</td>
						<!--<td>{$vo.hits}点击量</td>-->
						<!--<td>{$status[$vo['status']]} {$top_status[$vo['is_top']]} {$recommend_status[$vo['recommended']]}</td>-->
						<td>
							<a href="javascript:parent.openIframeLayer('{:url('AdminStockIn/edit',array('id'=>$vo['id']))}','产品入库',{});">入库</a>
						</td>
					</tr>
				</foreach>
				<tfoot>
				<tr>
					<th align="center" width="50">ID</th>

					<th width="400">名称</th>
					<th width="100">CAS#</th>
					<th width="100">结构式</th>

					<th width="130">首次入库</th>
					<!--<th width="70">{:lang('STATUS')}</th>-->
					<th width="100">{:lang('ACTIONS')}</th>
				</tr>
				</tfoot>
			</table>
			<ul class="pagination">{$page}</ul>
		</form>
	</div>
	<img id="cas-thumbnail-bigger" style="position: fixed;top: 50%;left: 50%;width: 300px;height: 300px;margin-left: -150px;margin-top: -150px;display: none;box-shadow: 0px 0px 20px rgba(0,0,0,0.2);"/>
	<script src="__STATIC__/js/admin.js"></script>
	<script>
		$(function(){
			var $cas_thumbnail_bigger=$('#cas-thumbnail-bigger');
			$('.cas-thumbnail').hover(function(){
				$cas_thumbnail_bigger.attr('src',$(this).attr('src'));
				$cas_thumbnail_bigger.show();
			},function(){
				$cas_thumbnail_bigger.hide();
			});
		});
	
	</script>
</body>
</html>